﻿<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2"
                   assembly="Recipes.NHibernate"
                   namespace="Recipes.NHibernate.Entities">

  <!-- more mapping info here -->

  <class name="ProductLine" table="ProductLine" schema="Production">

    <id name="ProductLineKey">
      <generator class="native" />
    </id>

    <property name="ProductLineName" />

    <bag name="Products" table="Product" schema="Production" cascade="all-delete-orphan"  lazy="true" inverse="true">
      <key column="ProductLineKey" />
      <one-to-many class="Product" />
    </bag>
  </class>

  <class name="Product" table="Product" schema="Production">

    <id name="ProductKey">
      <generator class="native" />
    </id>

    <property name="ProductName" />
    <!--<property name="ProductLineKey" />-->
    <property name="ShippingWeight" />
    <property name="ProductWeight" />

    <many-to-one name="ProductLine" column="ProductLineKey" not-null="true" />
  </class>
</hibernate-mapping>
